package com.zhangyx.crawler.core;

import com.zhangyx.crawler.comm.ThreadUtil;

public abstract class Schedule extends Thread {

    /**
     * 运行间隔 -毫秒
     * @return
     */
    public abstract int interval();

    /**
     * 任务
     */
    public abstract void schedule();


    @Override
    public void run() {
        while (!interrupted()) {
            schedule();
            ThreadUtil.sleepMills(interval());
        }
    }
}
